package com.iwhalecloud.bss.kite.cucc.service.pos.handler.impl;

import com.iwhalecloud.bss.kite.cucc.client.dto.pos.KitePosBaseDTO;
import com.iwhalecloud.bss.kite.cucc.service.pos.handler.IKitePosSceneHandler;

public abstract class KitePosBaseHandler<T extends KitePosBaseDTO> implements IKitePosSceneHandler {

    /**
     * 政企订单中心收单后，instanceId会重新生成，这里设置为属性传给订单中心，查订单详情时会返回
     * @param sceneInstId
     * @param instIdKey
     * @param instIdValue
     * @param posDto
     */
    /*protected void addInstanceIdAttr(String sceneInstId, String instIdKey, String instIdValue, T posDto) {
        IQuerySceneInstService querySceneInstService = SpringUtil.getBean(IQuerySceneInstService.class);
        Date createDate = querySceneInstService.getSceneInst(sceneInstId).getCreateDate();
        String createDateStr = KiteDateUtils.formatDate(createDate, KiteDateUtils.DATE_TIME_FORMAT_14);
        
        List<KitePosAttrDTO> attrs = posDto.getAttrs();
        if (KiteListUtils.isEmpty(attrs)) {
            attrs = new ArrayList<>();
        }
        if (attrs.stream().anyMatch((_attr) -> _attr.getCode().equals(instIdKey))) {
            return;
        }
        
        KitePosAttrDTO attr = new KitePosAttrDTO();
        attr.setType("STRING");
        attr.setCode(instIdKey);
        attr.setValue(instIdValue);
        attr.setStartDate(createDateStr);
        attr.setEndDate(LocalKeyConsts.ATTR_SEND_DATE);
        //attr.setChangeType(ChangeTypeUtils.getChangeType(ActionType.A.name()));
        attrs.add(attr);
        posDto.setAttrs(attrs);
    }*/
}
